//
//  DYPrinterManager.h
//  DYPrintSDK
//
//  Created by mr.ye on 2023/11/20.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <UIKit/UIKit.h>
#import <DYPrintSDK/DYPrintCmd.h>
#import <DYPrintSDK/DYPrintTaskCmd.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^printCall)(id   _Nullable obj,NSUInteger code);

@interface DYPrinterManager : NSObject
@property (nonatomic , strong, nullable) CBPeripheral *peripheral;

//初始化类(若使用DYBLEManager来管理外设，可以直接使用方法)
- (instancetype)initWithPeripheral:(CBPeripheral*)peripheral;

///检查打印的状态
-(void)checkPrintStates:(nullable void(^)(LuckBLEManagerStatus state))callback;

// 获取打印机信息
/// - Parameter callback: 回调
- (void)getPrinterInfo:(TaskCompelete)callback;

//获取关机时间
-(void)getShutTime:(TaskCompelete)compelete;

//获取打印机型号
-(void)getMode:(TaskCompelete)compelete;

//获取打印当前颜色
-(void)getPrintColor:(TaskCompelete)compelete;

//发送长数据(内部分包处理)
- (void)sendPrintDataCompelete:(TaskCompelete)compelete  data:(NSData*)data;

//设置关机时间
-(void)setShutTime:(TaskCompelete)compelete time:(NSInteger)time;

//设置颜色
-(void)setPrintColor:(TaskCompelete)compelete color:(NSInteger)color;

//设置纸张类
-(void)setPaperType:(TaskCompelete)compelete paper:(DYPrintPaperType)type;

//设置定位纸张类型
-(void)setPositionPaper:(TaskCompelete)compelete paper:(DYPrintPaperType)type;

//纸张退纸
-(void)setPaperBack:(TaskCompelete)compelete;
//进纸张
-(void)enterPaper:(TaskCompelete)compelete;


//更新固件
- (void)updateVersion:(NSData *)versionData callback:(nullable void(^)(NSError *error))callback
                 once:(void(^)(bool isOK))onceCall;

@end

NS_ASSUME_NONNULL_END
